Switch to poll() in cxenstored's IO loop
authorWei Liu <wei.liu2@citrix.com>
Mon, 25 Mar 2013 11:17:31 +0000 (11:17 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 11 Apr 2013 14:42:44 +0000 (15:42 +0100)
commitedb13df2aece2acf5a50f20aab79599173e55b2e
tree0b12b885efc521e1ebc272c10b56dfd98ad8252f
parent1b7720cd4b7a27e3b2c4ab67641d42c2aec31964
Switch to poll() in cxenstored's IO loop

Poll() can support more file descriptors than select(). We've done this for
xenconsoled, now do this for cxenstored as well.

The code is taken from xenconsoled and modified to adapt to cxenstored.

Note that poll() semantic is a bit different from select(). In Linux, if a fd
is set in IN/OUT fd_set and error occurs inside select(), this fd is still
considered readable / writable, and it is set in the returned IN/OUT fd_set.
So in later handle_input / handle_output, the connection will eventually be
talloc_free'ed(). After switching to poll(), we should take care of any error
right away, making the code clearer.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h